Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

355
Views
Resuelto |// Ejecutar comando en CMD [C#]

Básicamente, quiero ejecutar un comando en cmd porque necesito abrir Paint desde él, código que probé:

 System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C mspaint.exe, openFileDialog1.FileName;" process.StartInfo = startInfo; process.Start();

¿Alguien me puede ayudar? Quiero ejecutar paint con un archivo png elegido por el usuario.

Gracias Trevor por ayudar, quizás el otro código funcione.

 System.Diagnostics.Process process = new System.Diagnostics.Process(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden; startInfo.FileName = "cmd.exe"; startInfo.Arguments = "/C mspaint.exe, " + openFileDialog1.FileName; process.StartInfo = startInfo; process.Start();

Código funcionando bien

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Para abrir un archivo específico usando mspaint , puede especificar la ruta del archivo como argumento (sin ninguna coma):

 mspaint <filePath>

Desde el código puedes hacer lo siguiente:

 Process proc = new Process { StartInfo = new ProcessStartInfo { FileName = "cmd.exe", Arguments = $"/C mspaint.exe {openFileDialog1.FileName}", WindowStyle = ProcessWindowStyle.Hidden } }; proc.Start();
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!